package com.playball.lottery.frm.yhzx;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.text.Html;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;

import com.playball.lottery.R;
import com.playball.lottery.ApplicationData;
import com.playball.lottery.adapter.GridviewsAdapter;
import com.playball.lottery.base.BaseActivity;
import com.playball.lottery.customview.ShowTipDialog;
import com.playball.lottery.frm.view.ImagesActivity;
import com.playball.lottery.nt.GetRequestParams;
import com.playball.lottery.util.AppUtils;
import com.playball.lottery.util.Constants;
import com.playball.lottery.util.ConvertJsonToList;
import com.playball.lottery.util.KaiJiangUtil;
import com.playball.lottery.util.Logger;
import com.playball.lottery.util.LotUtil;
import com.playball.lottery.util.OKHttpConstants;
import com.playball.lottery.util.SysApplication;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

/**
 * 方案详情
 * 
 * @author Administrator
 * 
 */
public class PlanDetailsActivity extends BaseActivity {
	// private TextView textTitle;
	private TextView textNumber;// 开奖编号
	TextView plan_detail_lot_issue_name;
	TextView yhzx_detail_endtime;
	TextView plan_detail_lot_name;
	TextView yhzx_plan_detail_hv_name;
	TextView yhzx_plan_hh_detail_hv_name;
	TextView yhzx_plan_hh_detail_ysf_name;
	View yhzx_plan_hh_detail_ysf_name_line;
	ImageView plan_detail_lot_icon_img;
	private TextView textLaunchTime;
	private TextView textAmount;
	private TextView textStatus;
	private TextView textBonus;
	private TextView textPassType;
	private TextView textMultiple;
	/** 玩法 */
	private TextView textPlayType;
	private TextView textWinNumber;
	private TextView textMyMoney;
	private TextView textMyWinMoney;
	// private TextView textSecState;
	private TextView textView;
	private View layoutPassType;
	private View layoutHasDetail;
	private View layoutHasNoDetail;
	// private View layoutHasNoOpen;
	private View layoutListPar;
	private View layout_sfc_head_Par;
	private View layout_number_head_Par;
	private View layout_jc_head_Par;
	private View layout_jchh_head_par;
	// private View layoutListHeadLine;
	private Map<String, Object> mData;
	private List<Map<String, Object>> rData = new ArrayList<Map<String, Object>>();
	private int schemeID;
	private boolean isNumGame; // 是否为数字彩
	private boolean isJcBasketball;// 是否为竞彩篮球
	/** 是否为竞彩篮球大小分 */
	private boolean isJcBasketballDXF;
	/** 是否为竞彩篮球胜负 */
	private boolean isJcBasketballSF;
	/** 是否为竞彩篮球让分胜负 */
	private boolean isJcBasketballRFSF;
	/** 是否为竞彩篮球胜分差 */
	private boolean isJcBasketballSFC;
	/** 是否为竞彩篮球混合过关 */
	private boolean isJcBasketballHunHe;
	private boolean isSFC;// 是否为胜负彩
	private SimpleAdapter adapter = null;
	/** 彩种名称 */
	private String lottName;
	/** 竞彩足球，竞彩篮球,北单,玩法分类 */
	private String PlayTypeName = "";
	/** 是否为竞彩足球玩法让球胜平负 */
	private boolean isJczqRQSPF;
	/** 是否为竞彩足球玩法混合过关 */
	private boolean isJczqHunHe;
	/** 是否为竞彩足球玩法半全场 */
	private boolean isJczqBQC;
	/** 是否为竞彩足球玩法比分 */
	private boolean isJczqBF;
	/** 是否为竞彩足球玩法胜平负 */
	private boolean isJczqSPF;
	/** 是否为竞彩足球玩法 */
	private boolean isJcFootball;
	/** 是否无item,和BetType =2,3,4,5，需到网站查看方案详情 */
	private boolean isToWeb;
	/** 无显示方案或未上传 */
	private TextView yhzx_detail_tvNO;
	/** 是否是未上传,初始值false */
	private boolean isNotUpload;
	/** 是否是投注内容已经被保密,初始值false */
	private boolean isSecret;
	/** 数据来源,1新系统,0旧系统 */
	private int DataSource;
	/** 是否中奖 */
	boolean isMyWinMoney;

	private String playID;
	/** 是否为北京单场玩法半全场 */
	private boolean isBdBQC;
	/** 是否为北京单场玩法胜平负 */
	private boolean isBdSPF;
	/** 是否为北京单场玩法上下单双 */
	private boolean isBdSXDS;
	/** 是否为北京单场玩法比分 */
	private boolean isBdBF;
	/** 是否为北京单场玩法 */
	private boolean isBd;
	/** 是否为冠军玩法 */
	private boolean isGjwf;
	/** 佣金比例 */
	private TextView yhzx_detail_yongjinbl;
	/** 保底金额 */
	private TextView yhzx_detail_baodije;
	/** 认购进度 */
	private TextView yhzx_detail_rengoujd;
	/** 保底进度 */
	private TextView yhzx_detail_baodijd;
	/**  */
	private TextView yhzx_detail_zhushu;

	private TextView plan_detail_lot_buy_type;
	/** 佣金比例保底金额合买信息 */
	private LinearLayout yhzx_detail_llhemai1;
	/** 认购进度 合买信息 */
	private LinearLayout yhzx_detail_llhemai2;
	View layout_zhushu;
	View layout_playmethod;
	/** 底部选号投注 */
	private Button plan_detail_lot_xuanhaotouzhu;
	String LotName;

	// 一招制胜 里面 关闭 显示的 倍数
	private LinearLayout yhzx_detail_multiple_ll;

	private String ycjs_flag = "";

	private ListView plan_detail_list;
	private GridView yhzx_plan_grid;

	// 显示或隐藏方案详情
	private LinearLayout look_case_lin;
	private RelativeLayout showRela;
	private ImageView ivArrow;

	String UserID = ApplicationData.getInstance().getUserID();

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.yhzx_plan_detail);
		SysApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		schemeID = Integer.parseInt(intent.getStringExtra("SchemeID"));
		DataSource = Integer.parseInt(intent.getStringExtra("DataSource"));
		LotName = intent.getStringExtra("LotName");

		initView();

		startDetailThread();

		plan_detail_lot_xuanhaotouzhu.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				// TODO Auto-generated method stub
				/*
				 * if (isGjwf) { Intent intent = new
				 * Intent(PlanDetailsActivity.this,
				 * WorldCupGuessWinActivity.class);
				 * startActivityForResult(intent, 911); }else
				 */{
					// 跳转
					Class<?> activity = null;
					activity = KaiJiangUtil.getLotActivity(LotName);
					Intent intent = new Intent(PlanDetailsActivity.this, activity);
					startActivityForResult(intent, 911);
				}

			}
		});
	}

	public void onResume() {
		super.onResume();

	}

	public void onPause() {
		super.onPause();

	}

	class AsyncLoader extends AsyncTask<String, Integer, String> {// 继承AsyncTask

		String action;

		ShowTipDialog showdialog = new ShowTipDialog();

		// 1.准备运行
		protected void onPreExecute() {
			showdialog.showDialog(PlanDetailsActivity.this);
		}

		// 2.正在后台运行
		@Override
		protected String doInBackground(String... paramsArr) {
			// 处理后台执行的任务，在后台线程执行
			String strResult = null;

			action = paramsArr[1];
			// 获取请求返回值

			Logger.d("van", UserID + "-----------");
			strResult = GetRequestParams.getRequestUserIDResult(paramsArr[0], UserID, action, getApplicationContext());
			System.out.println("plan detail is " + strResult);
			// 获取请求返回值
			return strResult;
		}

		// 3.进度更新
		protected void onProgressUpdate(Integer... progress) {
		}

		// 4.完成后台任务
		protected void onPostExecute(String result) {
			if (result != null) {
				try {
					JSONTokener jsonParser = new JSONTokener(result);
					JSONObject js = (JSONObject) jsonParser.nextValue();
					// 接下来的就是JSON对象的操作了
					if (Integer.parseInt(js.getString("Code")) == 0) {
						if (action.equals("210")) {
							mData = getData(result);
							if (mData != null && !mData.equals("")) {
								showDetailContent();
							} else {
								Toast.makeText(PlanDetailsActivity.this, R.string.solution_does_not_exist, Toast.LENGTH_LONG).show();
								Intent intent = new Intent();
								intent.setClass(PlanDetailsActivity.this, BetRecordActivity.class);
								startActivity(intent);
							}
							showdialog.closeDialog();
						} else {
							Toast.makeText(PlanDetailsActivity.this, js.getString("Data"), Toast.LENGTH_SHORT).show();
						}
					} else {
						Toast.makeText(PlanDetailsActivity.this, js.getString("Data"), Toast.LENGTH_SHORT).show();
					}
				} catch (JSONException ex) {
					// 异常处理代码
					Log.e("error", ex.toString());
				} finally {
					showdialog.closeDialog();
				}
			} else {
				Toast.makeText(PlanDetailsActivity.this, getString(R.string.problem_01), Toast.LENGTH_LONG).show();
			}
		}

		// 5.完成后操作
		protected void onCancelled() {
		}

	}

	public void startDetailThread() {
		AsyncLoader task = new AsyncLoader();

		String[] dyn = new String[2];
		JSONObject params = new JSONObject();
		try {
			params.put("DataSource", DataSource);// 1
			params.put("SchemeID", schemeID);
			// params.put("SchemeID", "41997");
		} catch (JSONException ex) {
			// TODO Auto-generated catch block
			Log.e("error", ex.toString());
		}
		dyn[0] = params.toString();
		dyn[1] = "210";// 116
		task.execute(dyn);
	}

	public void initText() {
		textNumber = (TextView) findViewById(R.id.yhzx_detail_number);
		textAmount = (TextView) findViewById(R.id.yhzx_detail_amount);
		textBonus = (TextView) findViewById(R.id.yhzx_detail_bonus);
		textLaunchTime = (TextView) findViewById(R.id.yhzx_detail_launchtime);
		textStatus = (TextView) findViewById(R.id.yhzx_detail_status);

		// 这个字段要去除
		textWinNumber = (TextView) findViewById(R.id.yhzx_detail_winnumber);
		textMultiple = (TextView) findViewById(R.id.yhzx_detail_multiple);
		// textTitle = (TextView) findViewById(R.id.yhzx_detail_title);
		yhzx_detail_endtime = (TextView) findViewById(R.id.yhzx_detail_endtime);
		plan_detail_lot_issue_name = (TextView) findViewById(R.id.plan_detail_lot_issue_name);
		plan_detail_lot_name = (TextView) findViewById(R.id.plan_detail_lot_name);
		yhzx_plan_detail_hv_name = (TextView) findViewById(R.id.yhzx_plan_detail_hv_name);
		yhzx_plan_hh_detail_hv_name = (TextView) findViewById(R.id.yhzx_plan_hh_detail_hv_name);
		yhzx_plan_hh_detail_ysf_name = (TextView) findViewById(R.id.yhzx_plan_hh_detail_ysf_name);
		yhzx_plan_hh_detail_ysf_name_line = findViewById(R.id.yhzx_plan_hh_detail_ysf_name_line);
		plan_detail_lot_icon_img = (ImageView) findViewById(R.id.plan_detail_lot_icon_img);
		textPassType = (TextView) findViewById(R.id.yhzx_detail_passtype);
		textPlayType = (TextView) findViewById(R.id.yhzx_detail_playtype);

		textView = (TextView) findViewById(R.id.yhzx_detail_textView);

		textMyMoney = (TextView) findViewById(R.id.yhzx_detail_mymoney);
		textMyWinMoney = (TextView) findViewById(R.id.yhzx_detail_mywinmoney);
		// textSecState = (TextView) findViewById(R.id.yhzx_detail_secstate);
		// 保底金额 认购进度
		yhzx_detail_llhemai1 = (LinearLayout) findViewById(R.id.yhzx_detail_llhemai1);
		yhzx_detail_llhemai2 = (LinearLayout) findViewById(R.id.yhzx_detail_llhemai2);
		yhzx_detail_yongjinbl = (TextView) findViewById(R.id.yhzx_detail_yongjinbl);
		yhzx_detail_baodije = (TextView) findViewById(R.id.yhzx_detail_baodije);
		yhzx_detail_rengoujd = (TextView) findViewById(R.id.yhzx_detail_rengoujd);
		yhzx_detail_baodijd = (TextView) findViewById(R.id.yhzx_detail_baodijd);
		yhzx_detail_zhushu = (TextView) findViewById(R.id.yhzx_detail_zhushu);

		yhzx_detail_multiple_ll = (LinearLayout) findViewById(R.id.yhzx_detail_multiple_ll);
	}

	public void initView() {
		plan_detail_lot_xuanhaotouzhu = (Button) findViewById(R.id.plan_detail_lot_xuanhaotouzhu);
		// 有数据
		layoutPassType = findViewById(R.id.yhzx_detail_layout_passtype);
		layoutHasDetail = findViewById(R.id.yhzx_detail_layout01);
		layout_zhushu = findViewById(R.id.yhzx_detail_layout_passtype_zhushu);
		layout_playmethod = findViewById(R.id.yhzx_detail_layout_passtype_palymethod);
		// 未上传或无详情内容
		layoutHasNoDetail = findViewById(R.id.yhzx_detail_layout02);
		yhzx_detail_tvNO = (TextView) findViewById(R.id.yhzx_detail_tv_nodetail);
		plan_detail_lot_buy_type = (TextView) findViewById(R.id.plan_detail_lot_buy_type);
		initText();

		// 胜负彩、任选九相关
		layoutListPar = findViewById(R.id.yhzx_plan_detail_list_par);
		layout_sfc_head_Par = findViewById(R.id.yhzx_plan_detail_list_head_par);
		layout_jc_head_Par = findViewById(R.id.yhzx_plan_detail_list_jc_bd_head_par);
		layout_number_head_Par = findViewById(R.id.yhzx_plan_detail_list_number_head_par);
		layout_jchh_head_par = findViewById(R.id.yhzx_plan_detail_list_jchh_bd_head_par);
		// layoutListHeadLine =
		// findViewById(R.id.yhzx_plan_detail_list_head_line);
		plan_detail_list = (ListView) findViewById(R.id.plan_detail_list);
		yhzx_plan_grid= (GridView) findViewById(R.id.yhzx_plan_grid);
		look_case_lin = (LinearLayout) findViewById(R.id.look_case_lin);
		showRela = (RelativeLayout) findViewById(R.id.showRela);
		ivArrow = (ImageView) findViewById(R.id.ivArrow);
		// 显示隐藏事件
		look_case_lin.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (showRela.getVisibility() == View.GONE) {
					showRela.setVisibility(View.VISIBLE);
					ivArrow.setBackgroundResource(R.drawable.hemai_up);
					// handler.post(new Runnable() {
					// @Override
					// public void run() {
					// hemai_scr.fullScroll(ScrollView.FOCUS_DOWN);
					// }
					// });
				} else {
					showRela.setVisibility(View.GONE);
					ivArrow.setBackgroundResource(R.drawable.hemai_down);
				}

			}
		});
		// 标题
		titleBar();
	}

	private Map<String, Object> getData(String strResult) {
		Map<String, Object> listmap = new HashMap<String, Object>();
		try {
			JSONTokener jsonParser = new JSONTokener(strResult);
			JSONObject js = (JSONObject) jsonParser.nextValue();
			int code = Integer.parseInt(js.getString("Code"));
			if (code < 0) {
				Toast.makeText(PlanDetailsActivity.this, js.getString("Data"), Toast.LENGTH_LONG).show();
				listmap = null;
			} else {
				listmap = ConvertJsonToList.getMap(js.getString("Data"));
				String TicketPicture= (String) listmap.get("TicketPicture");
				String[] str=TicketPicture.split(";");
				final String[] strs=str;
				if (TicketPicture != null &&!TicketPicture.equals("")){
					yhzx_plan_grid.setVisibility(View.VISIBLE);
					GridviewsAdapter adapter=new GridviewsAdapter(getApplicationContext(),str,PlanDetailsActivity.this);
					yhzx_plan_grid.setAdapter(adapter);
					yhzx_plan_grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
						@Override
						public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
							Intent intent = new Intent(PlanDetailsActivity.this,ImagesActivity.class);
							intent.putExtra("str",strs[i]);
							startActivity(intent);
						}
					});
				}
				// Log.d("plandetail",
				// "getData 服务器返回数据listmap= "+listmap.toString());
				// 无LotNumber时显示内容 SecState IsCanSee LotNumber=未上传
				if (listmap.get("SecState") != null) {
					if (!"公开".equals(listmap.get("SecState").toString())) {
						isSecret = true;
					}
				}
				if (listmap.get("LotNumber") != null) {
					if ("未上传".equals(listmap.get("LotNumber").toString())) {
						isNotUpload = true;
					} else {
						isNotUpload = false;
					}
				}
				// Log.e("pgetData", "isNotUpload= "+isNotUpload);
				if (listmap.get("IsShow") != null) {
					if ("false".equals(listmap.get("IsShow").toString())) {
						isToWeb = true;
					}
				}
				// Log.e("pgetData", "isToWeb= "+isToWeb);
				playID = listmap.get("LottID").toString();
				lottName = listmap.get("LottName").toString();
				isJcBasketball = false;
				isSFC = false;
				layout_sfc_head_Par.setVisibility(View.GONE);
				// layoutListHeadLine.setVisibility(View.GONE);
				layout_playmethod.setVisibility(View.GONE);
				layout_jc_head_Par.setVisibility(View.GONE);
				layout_number_head_Par.setVisibility(View.GONE);
				layout_jchh_head_par.setVisibility(View.GONE);
				try {
					if (lottName.indexOf("竞彩", 0) >= 0 || lottName.indexOf("足彩北京单场", 0) >= 0 || lottName.indexOf("猜冠军玩法", 0) >= 0) {
						if (lottName.indexOf("竞彩篮球", 0) >= 0) {
							isJcBasketball = true;
						} else if (lottName.indexOf("竞彩足球", 0) >= 0) {
							isJcFootball = true;
						} else if (lottName.indexOf("足彩北京单场", 0) >= 0) {
							isBd = true;
						} else if (lottName.indexOf("猜冠军玩法", 0) >= 0) {
							isGjwf = true;
						}
						rData = getMatches(listmap);
						isNumGame = false;
						if (isNotUpload && !isToWeb) {
							layoutPassType.setVisibility(View.GONE);
						}
						if (isJczqHunHe == true || isJcBasketballHunHe == true) {
							layout_jchh_head_par.setVisibility(View.VISIBLE);
						} else {
							layout_jc_head_Par.setVisibility(View.VISIBLE);
						}
						layout_playmethod.setVisibility(View.VISIBLE);
						layout_zhushu.setVisibility(View.GONE);
					} else if (LotName.contains("胜负彩") || LotName.contains("任选九")) {
						isSFC = true;
						layout_sfc_head_Par.setVisibility(View.VISIBLE);
						// layoutListHeadLine.setVisibility(View.VISIBLE);
						rData = getSFCMatches(listmap);
						isNumGame = false;
						layoutPassType.setVisibility(View.GONE);
					} else {
						Map<String, Object> lnmap = new HashMap<String, Object>();
						layout_number_head_Par.setVisibility(View.VISIBLE);
						if (listmap.get("LotNumber") != null) {

							if (!"未上传".equals(listmap.get("LotNumber").toString()) && !"".equals(listmap.get("LotNumber").toString())) {
								lnmap = ConvertJsonToList.getMap(listmap.get("LotNumber").toString());
								// 显示数字彩倍数
								if (lnmap.get("Multiple") != null) {
									textMultiple.setText(lnmap.get("Multiple").toString());// 倍数
								}
								List<Map<String, Object>> lnlist = new ArrayList<Map<String, Object>>();
								if (lnmap.get("item") != null) {
									lnlist = ConvertJsonToList.getList(lnmap.get("item").toString());
								}

								// 名字 及 投注号
								if (lnlist != null) {
									isDltZj = false;
									for (int i = 0; i < lnlist.size(); i++) {
										Map<String, Object> map = new HashMap<String, Object>();
										map.put("PlayTypeName", lnlist.get(i).get("PlayTypeName"));
										String string = lnlist.get(i).get("PlayTypeName").toString();
										if (string.contains("追加")) {
											isDltZj = true;
										}
										if (lnlist.get(i).containsKey("ColorNumber")) {
											map.put("LotNum", lnlist.get(i).get("ColorNumber"));
										} else {
											map.put("LotNum", lnlist.get(i).get("LotNumber"));
										}
										rData.add(map);
									}
								}
							}
						}
						isNumGame = true;
						layoutPassType.setVisibility(View.GONE);
					}
				} catch (Exception e) {
					e.printStackTrace();
					rData = null;
					isNumGame = true;
					layoutPassType.setVisibility(View.GONE);
				}
			}
		} catch (JSONException ex) {
			// 异常处理代码
			Log.e("error", ex.toString());
			listmap = null;
		}
		return listmap;
	}

	public boolean isDltZj = false;

	/**
	 * 放入数据，显示listview视图
	 */
	public void showDetailContent() {
		String number = (String) mData.get("LotNumber");

		// boolean isJoinBuy =
		// Boolean.parseBoolean(mData.get("IsJoinBuy").toString());
		// if (true == isJoinBuy) {
		// plan_detail_lot_buy_type.setText("合买");
		// } else {
		// plan_detail_lot_buy_type.setText("自购");
		// }

		plan_detail_lot_buy_type.setText("自购");

		if (number == null || number.equals("")) {
			layoutHasNoDetail.setVisibility(View.VISIBLE);
			layoutHasDetail.setVisibility(View.GONE);
			textWinNumber.setVisibility(View.GONE);
			textView.setVisibility(View.GONE);

			setTextView();
		} else {
			Boolean iscansee = (Boolean) mData.get("IsCanSee");
			// 如果可见
			if (iscansee) {
				if (!isNotUpload && !isToWeb) {
					layoutHasDetail.setVisibility(View.VISIBLE);
					layoutHasNoDetail.setVisibility(View.GONE);
				} else {
					layoutHasDetail.setVisibility(View.GONE);
					layoutHasNoDetail.setVisibility(View.VISIBLE);
				}
			} else {
				layoutHasDetail.setVisibility(View.GONE);
				layoutHasNoDetail.setVisibility(View.VISIBLE);
			}
			if (isNumGame) {
				textWinNumber.setVisibility(View.VISIBLE);
				textView.setVisibility(View.VISIBLE);
				if (mData.get("State").toString().equals("未开奖")) {
					textWinNumber.setText("未开奖");
				} else {
					textWinNumber.setText(mData.get("WinLotNumber").toString());
				}
				setTextView();
				adapter = new NumberPlanDetailAdapter(PlanDetailsActivity.this, rData, R.layout.yhzx_plan_detail_numgamelist, new String[] { "PlayTypeName",
						"LotNum" }, new int[] { R.id.yhzx_plan_detail_PlayTypeName, R.id.yhzx_plan_detail_winnum }, textWinNumber.getText().toString(), playID);
				plan_detail_list.setAdapter(adapter);
			} else {
				textWinNumber.setVisibility(View.GONE);
				textView.setVisibility(View.GONE);
				setTextView();
				if (isGjwf) {

					plan_detail_lot_xuanhaotouzhu.setVisibility(View.GONE);

					// 这里进行特殊处理
					plan_detail_list.setVisibility(View.GONE);
					layout_jchh_head_par.setVisibility(View.GONE);
					layout_jc_head_Par.setVisibility(View.GONE);

					LinearLayout cup_guess_win_ll = (LinearLayout) findViewById(R.id.yhzx_plan_detail_list_jchh_guess_win_ll);
					cup_guess_win_ll.setVisibility(View.VISIBLE);

					LinearLayout cup_guess_win_ll_01 = (LinearLayout) findViewById(R.id.yhzx_plan_detail_list_jchh_guess_win_01);
					cup_guess_win_ll_01.setVisibility(View.VISIBLE);
					LinearLayout cup_guess_win_ll_02 = (LinearLayout) findViewById(R.id.yhzx_plan_detail_list_jchh_guess_win_02);

					// Log.d("van", number);
					try {
						ArrayList<String> teams = new ArrayList<String>();
						ArrayList<String> cgs = new ArrayList<String>();
						JSONObject object = new JSONObject(number);
						JSONArray array = object.getJSONArray("item");
						for (int i = 0; i < array.length(); i++) {
							String team = array.getJSONObject(i).getString("team");
							String cg = array.getJSONObject(i).getString("cg");
							teams.add(team);
							cgs.add(cg);
						}

						TextView name_001 = (TextView) findViewById(R.id.yhzx_plan_hh_detail_hv_guess_win_name_01);
						name_001.setText(teams.get(0));
						TextView guess_win_cg_01 = (TextView) findViewById(R.id.guess_win_cg_01);
						if (!AppUtils.isBlank(cgs.get(0))) {
							// guess_win_cg_01.setText(cgs.get(0));
							guess_win_cg_01.setText(Html.fromHtml(String.format(cgs.get(0))));
						} else {
							// guess_win_cg_01.setText("-");

							guess_win_cg_01.setText(Html.fromHtml(String.format("<font color=red>%s</font>", "-")));
						}

						// String team =
						// array.getJSONObject(0).getString("team");
						if (teams.size() > 1) {

							cup_guess_win_ll_02.setVisibility(View.VISIBLE);
							TextView name_002 = (TextView) findViewById(R.id.yhzx_plan_hh_detail_hv_guess_win_name_02);
							name_002.setText(teams.get(1));
							TextView guess_win_cg_02 = (TextView) findViewById(R.id.guess_win_cg_02);
							if (!AppUtils.isBlank(cgs.get(1))) {
								// guess_win_cg_02.setText(cgs.get(1));
								guess_win_cg_02.setText(Html.fromHtml(String.format(cgs.get(1))));
							} else {
								guess_win_cg_02.setText(Html.fromHtml(String.format("<font color=red>%s</font>", "-")));
							}
							// cup_guess_win_txt.setText("猜冠军："+teams.get(0) +
							// " , "+ teams.get(1));
						} else {
							// cup_guess_win_txt.setText("猜冠军："+teams.get(0) );
							cup_guess_win_ll_02.setVisibility(View.GONE);

						}

						// Log.d("van", team);
					} catch (JSONException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}

				} else if (isSFC) {
					adapter = new SFCPlanDetailAdapter/*
													 * () ; SimpleAdapter
													 */(PlanDetailsActivity.this, rData, R.layout.yhzx_plan_detail_sfc_list, new String[] { "NO", "Content",
							"HTeam", "VTeam", "Result", "Score"/*
																 * , "OuOdds"
																 */}, new int[] { R.id.yhzx_detail_list_mno, R.id.yhzx_detail_list_tzh,
							R.id.yhzx_detail_list_hteam, R.id.yhzx_detail_list_vteam, R.id.yhzx_detail_list_cg, R.id.yhzx_detail_list_score /*
																																			 * ,
																																			 * R
																																			 * .
																																			 * id
																																			 * .
																																			 * yhzx_detail_list_op
																																			 */});
				} else {
					if (isJcBasketball) {
						yhzx_plan_detail_hv_name.setText("客队VS主队");
						List<Map<String, Object>> lqList = new ArrayList<Map<String, Object>>();
						lqList = modifymjclqData(rData);
						if (lqList != null) {
							if (isJcBasketballDXF) {
								adapter = new jclqDXFPlanDetailAdapter(PlanDetailsActivity.this, lqList, R.layout.yhzx_plan_detail_jclq_list, new String[] {
										"MNo", "Content", "VTeam", "HTeam", "Cg", "ysf", "Score", "ysftv" }, new int[] { R.id.yhzx_detail_list_mno,
										R.id.yhzx_detail_list_tzh, R.id.yhzx_detail_list_vteam, R.id.yhzx_detail_list_hteam, R.id.yhzx_detail_list_cg,
										R.id.yhzx_detail_list_rq, R.id.yhzx_detail_list_score, R.id.yhzx_detail_list_tvysf, });
							} else if (isJcBasketballRFSF) {
								adapter = new jclqRFSFPlanDetailAdapter(PlanDetailsActivity.this, lqList, R.layout.yhzx_plan_detail_jclq_list, new String[] {
										"MNo", "Content", "VTeam", "HTeam", "Cg", "Rq", "Score" }, new int[] { R.id.yhzx_detail_list_mno,
										R.id.yhzx_detail_list_tzh, R.id.yhzx_detail_list_vteam, R.id.yhzx_detail_list_hteam, R.id.yhzx_detail_list_cg,
										R.id.yhzx_detail_list_rq, R.id.yhzx_detail_list_score });
							} else if (isJcBasketballHunHe) {
								yhzx_plan_hh_detail_hv_name.setText("客队VS主队");
								yhzx_plan_hh_detail_ysf_name.setText("让分");
								yhzx_plan_hh_detail_ysf_name.setVisibility(View.GONE);
								yhzx_plan_hh_detail_ysf_name_line.setVisibility(View.GONE);
								adapter = new jclqHunHePlanDetailAdapter(PlanDetailsActivity.this, lqList, R.layout.yhzx_plan_detail_jczqhunhe_list,
										new String[] { "MNo", "Content", "VTeam", "HTeam", "Rf", "Score" }, new int[] { R.id.yhzx_detail_list_mno,
												R.id.yhzx_detail_list_tzh, R.id.yhzx_detail_list_vteam, R.id.yhzx_detail_list_hteam, R.id.yhzx_detail_list_rf,
												R.id.yhzx_detail_list_score });
							} else {
								adapter = new jclqPlanDetailAdapter(PlanDetailsActivity.this, lqList, R.layout.yhzx_plan_detail_jclq_list, new String[] {
										"MNo", "Content", "VTeam", "HTeam", "Cg", "Score" }, new int[] { R.id.yhzx_detail_list_mno, R.id.yhzx_detail_list_tzh,
										R.id.yhzx_detail_list_vteam, R.id.yhzx_detail_list_hteam, R.id.yhzx_detail_list_cg, R.id.yhzx_detail_list_score });
							}
						}
					} else {
						List<Map<String, Object>> zqList = new ArrayList<Map<String, Object>>();
						zqList = modifymZQData(rData);
						if (zqList != null) {
							if (isJczqHunHe) {

								if ("6".equals(ycjs_flag)) {
									adapter = new jczqhhPlanDetailAdapter(PlanDetailsActivity.this, zqList, R.layout.yhzx_plan_detail_jczqhunhe_list,
											new String[] { "MNo", "Content", "HTeam", "VTeam", "hScore", "Score" }, new int[] { R.id.yhzx_detail_list_mno,
													R.id.yhzx_detail_list_tzh, R.id.yhzx_detail_list_hteam, R.id.yhzx_detail_list_vteam,
													R.id.yhzx_detail_list_hscore, R.id.yhzx_detail_list_score });
								} else {
									adapter = new jczqhhPlanDetailAdapter(PlanDetailsActivity.this, zqList, R.layout.yhzx_plan_detail_jczqhunhe_list,
											new String[] { "MNo", "Content", "HTeam", "VTeam", "hScore", "Score" }, new int[] { R.id.yhzx_detail_list_mno,
													R.id.yhzx_detail_list_tzh, R.id.yhzx_detail_list_hteam, R.id.yhzx_detail_list_vteam,
													R.id.yhzx_detail_list_hscore, R.id.yhzx_detail_list_score });
								}

							} else {
								adapter = new jczqPlanDetailAdapter(PlanDetailsActivity.this, zqList, R.layout.yhzx_plan_detail_jc_list, new String[] { "MNo",
										"Content", "HTeam", "VTeam", "Cg", "Score" }, new int[] { R.id.yhzx_detail_list_mno, R.id.yhzx_detail_list_tzh,
										R.id.yhzx_detail_list_hteam, R.id.yhzx_detail_list_vteam, R.id.yhzx_detail_list_cg, R.id.yhzx_detail_list_score });
							}

						}
					}

				}
				if (adapter != null) {
					plan_detail_list.setAdapter(adapter);
				}

			}
		}
	}

	public void setTextView() {
		// 合买方案加佣金比例，进度
		if (mData.containsKey("IsJoinBuy")) {
			if (mData.get("IsJoinBuy").toString().equals("true")) {
				yhzx_detail_llhemai1.setVisibility(View.VISIBLE);
				yhzx_detail_llhemai2.setVisibility(View.VISIBLE);
				if (mData.get("Bonus").toString().equals("0")) {
					yhzx_detail_yongjinbl.setText(mData.get("Bonus").toString());
				} else {
					yhzx_detail_yongjinbl.setText(mData.get("Bonus").toString() + "%");
				}
				// 保底进度=AM/Money
				BigDecimal bdZMoney = new BigDecimal(mData.get("Money").toString().replaceAll(",", "").trim());
				BigDecimal bdrgAM = new BigDecimal(mData.get("AM").toString().replaceAll(",", "").trim());
				BigDecimal bd100 = new BigDecimal("100");
				// 整数 BigDecimal.ROUND_CEILING
				// 如果是正数，按ROUND_UP处理，如果是负数，按照ROUND_DOWN处理。例如7.1->8;
				// -7.1->-7;所以这种近似的结果都会>=实际值。
				String renGouJD = bdrgAM.multiply(bd100).divide(bdZMoney, 2, BigDecimal.ROUND_HALF_UP).setScale(0, BigDecimal.ROUND_CEILING).toString();
				yhzx_detail_baodijd.setText(renGouJD + "%");
				String tempBd = "";
				if (!renGouJD.equals("0")) {
					tempBd = "+" + new DecimalFormat("#0.00").format(bdrgAM.doubleValue() * 100 / bdZMoney.doubleValue()) + "%"
							+ "<font color='#EF0505'>(保)</font>";
				}
				yhzx_detail_baodije.setText(mData.get("AM").toString());
				// if(mData.get("Schedule").toString().equals("0")){
				yhzx_detail_rengoujd.setText(Html.fromHtml(mData.get("Schedule").toString() + "%" + tempBd));
				// }

			} else {
				yhzx_detail_llhemai1.setVisibility(View.GONE);
				yhzx_detail_llhemai2.setVisibility(View.GONE);
			}
		} else {
			yhzx_detail_llhemai1.setVisibility(View.GONE);
			yhzx_detail_llhemai2.setVisibility(View.GONE);
		}

		if (mData.get("SchemeNumber") != null) {
			textNumber.setText(mData.get("SchemeNumber").toString());// SchemeNumber：方案号
		}
		textAmount.setText(mData.get("Money").toString());
		textBonus.setText(mData.get("WinMoney").toString());
		textLaunchTime.setText(mData.get("StartTime").toString());
		textStatus.setText(mData.get("State").toString());

		textMyMoney.setText(mData.get("MyMoney").toString());
		textMyWinMoney.setText(mData.get("MyWinMoney").toString());
		// int tempallmoney =
		// Integer.parseInt(mData.get("Money").toString().replaceAll(",",
		// "").trim());
		// int tempmu = Integer.parseInt(textMultiple.getText().toString());
		// int restusf = tempallmoney/tempallmoney;
		if (true == isDltZj) {
			yhzx_detail_zhushu.setText((int) ((Float.parseFloat(mData.get("Money").toString().replaceAll(",", "").trim()) / 3) / Integer.parseInt(textMultiple
					.getText().toString())) + "注");

		} else {
			yhzx_detail_zhushu.setText((int) ((Float.parseFloat(mData.get("Money").toString().replaceAll(",", "").trim()) / 2) / Integer.parseInt(textMultiple
					.getText().toString())) + "注");
		}
		if (!mData.get("MyWinMoney").toString().equals("") && (!mData.get("MyWinMoney").toString().equals("0.00"))
				&& (!mData.get("MyWinMoney").toString().equals("-")) && (!mData.get("MyWinMoney").toString().equals("0"))) {
			isMyWinMoney = true;
		}
		// textSecState.setText(mData.get("SecState").toString());
		// LottName=竞彩篮球 "PlayTypeName": "让分胜负", lqPlayTypeName
		String logtname = mData.get("LottName").toString();
		plan_detail_lot_name.setText(logtname);
		plan_detail_lot_issue_name.setText("第" + mData.get("Issue").toString() + "期");
		yhzx_detail_endtime.setText(mData.get("BuyEndTime").toString());
		plan_detail_lot_icon_img.setImageResource(LotUtil.getLotIconIDByName(logtname));
		// if ("竞彩篮球".equals(mData.get("LottName").toString())) {
		// textTitle.setText(mData.get("LottName").toString() + PlayTypeName +
		// mData.get("Issue").toString() + "期");
		// } else {
		// textTitle.setText(mData.get("LottName").toString() +
		// mData.get("Issue").toString() + "期");
		// }
		// LotNumber没有item时,及BetType =2,3,4,5,显示请至网站查看方案详情.默认显示未上传
		if (isToWeb) {
			yhzx_detail_tvNO.setText("请至网站查看方案详情");
		}
		Boolean iscansee = (Boolean) mData.get("IsCanSee");
		if (!iscansee) {
			if (isSecret) {
				yhzx_detail_tvNO.setText(mData.get("SecState").toString());
			}
		}
		if (isNotUpload) {
			yhzx_detail_tvNO.setText("未上传");
		}

	}

	/**
	 * 获取竞彩足球，竞彩篮球,北单赛事数据
	 * 
	 * @param data
	 * @return
	 */
	private List<Map<String, Object>> getMatches(Map<String, Object> data) {

		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		Map<String, Object> numMap = new HashMap<String, Object>();
		if (data.get("LotNumber") != null) {
			if (!"未上传".equals(data.get("LotNumber").toString()) && !"".equals(data.get("LotNumber").toString())) {
				numMap = ConvertJsonToList.getMap(data.get("LotNumber").toString());
				// Log.d("zulq getMatches", "numMap= "+numMap.toString());
				if (numMap.get("PlayTypeName") != null) {
					if ("6".equals(data.get("BetType").toString())) {
						textPlayType.setText("一场决胜");// 玩法
					} else {
						textPlayType.setText(numMap.get("PlayTypeName").toString());// 玩法
					}
				}
				if (numMap.get("PassWay") != null) {
					if ("6".equals(data.get("BetType").toString())) {

						if (!AppUtils.isBlank(numMap.get("PassWay").toString())) {
							textPassType.setText(numMap.get("PassWay").toString());// 过关方式
						} else {
							textPassType.setText("2串1");
						}

					} else {
						textPassType.setText(numMap.get("PassWay").toString());// 过关方式
					}
				}
				if (numMap.get("Multiple") != null) {
					// Log.d("van",data.get("BetType").toString());
					if ("6".equals(data.get("BetType").toString())) {
						yhzx_detail_multiple_ll.setVisibility(View.GONE);
						ycjs_flag = data.get("BetType").toString();
					} else {
						textMultiple.setText(numMap.get("Multiple").toString());// 倍数
					}

				}
				if (numMap.get("item") != null) {
					list = ConvertJsonToList.getList(numMap.get("item").toString());
				}

				PlayTypeName = numMap.get("PlayTypeName").toString();
				if (isJcBasketball) {
					if ("大小分".equals(PlayTypeName)) {
						isJcBasketballDXF = true;
					} else if ("胜负".equals(PlayTypeName)) {
						isJcBasketballSF = true;
					} else if ("让分胜负".equals(PlayTypeName)) {
						isJcBasketballRFSF = true;
					} else if ("胜分差".equals(PlayTypeName)) {
						isJcBasketballSFC = true;
					} else if ("混合过关".equals(PlayTypeName)) {
						isJcBasketballHunHe = true;
					}

				} else if (isJcFootball) {
					if ("让球胜平负".equals(PlayTypeName)) {
						isJczqRQSPF = true;
					} else if ("混合过关".equals(PlayTypeName)) {
						isJczqHunHe = true;
					} else if ("猜比分".equals(PlayTypeName)) {
						isJczqBF = true;
					} else if ("半全场".equals(PlayTypeName)) {
						isJczqBQC = true;
					} else if ("胜平负".equals(PlayTypeName)) {
						isJczqSPF = true;
					}
				} else if (isBd) {
					if ("半全场".equals(PlayTypeName)) {
						isBdBQC = true;
					} else if ("胜平负".equals(PlayTypeName)) {
						isBdSPF = true;
					} else if ("上下盘".equals(PlayTypeName) || "上下单双".equals(PlayTypeName)) {
						isBdSXDS = true;
					} else if ("猜比分".equals(PlayTypeName)) {
						isBdBF = true;
					}
				}
			}
		}
		return list;
	}

	/**
	 * 获取任选9，胜负彩赛事信息
	 * 
	 * @param data
	 * @return
	 */
	private List<Map<String, Object>> getSFCMatches(Map<String, Object> data) {
		Map<String, Object> map = new HashMap<String, Object>();
		List<Map<String, Object>> newlist = new ArrayList<Map<String, Object>>();
		if (data.get("LotNumber") != null) {
			if (!"未上传".equals(data.get("LotNumber").toString()) && !"".equals(data.get("LotNumber").toString())) {
				map = ConvertJsonToList.getMap(data.get("LotNumber").toString());
				List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
				if (map.get("Multiple") != null) {
					textMultiple.setText(map.get("Multiple").toString());// 倍数
				}
				if (map.get("item") != null) {
					list = ConvertJsonToList.getList(map.get("item").toString());
				}
				int length = list.size();

				for (int i = 0; i < length; i++) {
					Map<String, Object> oldmap = new HashMap<String, Object>();
					oldmap = list.get(i);
					Map<String, Object> newmap = new HashMap<String, Object>();
					// "NO", "Content", "HTeam", "VTeam", "Result", "Score"
					// ----sfc
					// String HTeam =
					// oldmap.get("vs").toString().split("\\(")[0];
					// String VTeam =
					// oldmap.get("vs").toString().split("\\)")[1];
					// newmap.put("HTeam", HTeam);// 巴伊亚（2:1）戈亚斯
					// newmap.put("VTeam", VTeam);
					newmap.put("HTeam", oldmap.get("vs").toString());
					newmap.put("VTeam", oldmap.get("vs").toString());
					newmap.put("Result", oldmap.get("cg"));
					// newmap.put("VS", HTeam+"vs"+VTeam);
					// list.get(i).put("OuOdds", oldmap.get("content"));
					// newmap.put("MTime", oldmap.get("mtime"));
					// list.get(i).put("IsDan", oldmap.get("content"));
					newmap.put("Content", oldmap.get("content"));
					newmap.put("Score", oldmap.get("score"));
					newmap.put("NO", oldmap.get("no"));
					newlist.add(newmap);
				}
			}
		}
		// Log.d("getSFCMatches", "333333333 newlist= "+newlist.toString());
		return newlist;
	}

	/**
	 * 处理竞彩篮球玩法网络数据，按listview字段分别适应加载到SimpleAdapter
	 */
	public List<Map<String, Object>> modifymjclqData(List<Map<String, Object>> list) {
		// "MNo", "Content", "HTeam", "VTeam", "Cg", "ysf", "Score","ysftv" 大小分
		// "MNo", "Content", "HTeam", "VTeam", "Cg", "Rq", "Score"
		// Log.v("list= ", list.toString());
		if (list != null && (!"".equals(list)) && list.size() != 0) {
			List<Map<String, Object>> NewList = new ArrayList<Map<String, Object>>();
			for (int i = 0; i < list.size(); i++) {
				Map<String, Object> OldMap = list.get(i);
				Map<String, Object> NewMap = new HashMap<String, Object>();
				if (isJcBasketballDXF) {
					NewMap.put("MNo", OldMap.get("no"));
					NewMap.put("Content", OldMap.get("content"));
					NewMap.put("HTeam", OldMap.get("vs")/* OldMap.get("hteam") */);
					NewMap.put("VTeam", OldMap.get("vs")/* OldMap.get("vteam") */);
					NewMap.put("Cg", OldMap.get("cg"));
					NewMap.put("ysf", OldMap.get("pre"));
					NewMap.put("Score", OldMap.get("score"));
					NewMap.put("ysftv", "预设分:");
				} else if (isJcBasketballSF || isJcBasketballSFC) {
					NewMap.put("MNo", OldMap.get("no"));
					NewMap.put("Content", OldMap.get("content"));
					NewMap.put("HTeam", OldMap.get("vs")/* OldMap.get("hteam") */);
					NewMap.put("VTeam", OldMap.get("vs")/* OldMap.get("vteam") */);
					NewMap.put("Cg", OldMap.get("cg"));
					NewMap.put("Rq", "");
					NewMap.put("Score", OldMap.get("score"));
				} else if (isJcBasketballRFSF) {
					NewMap.put("MNo", OldMap.get("no"));
					NewMap.put("Content", OldMap.get("content"));
					NewMap.put("HTeam", OldMap.get("vs"));
					NewMap.put("VTeam", OldMap.get("vs"));
					// NewMap.put("HTeam", OldMap.get("hteam"));
					// NewMap.put("VTeam", OldMap.get("vteam"));
					NewMap.put("Cg", OldMap.get("cg"));
					NewMap.put("Rq", OldMap.get("rf"));
					NewMap.put("Score", OldMap.get("score"));
				} else if (isJcBasketballHunHe) {
					NewMap.put("MNo", OldMap.get("no"));
					NewMap.put("Content", OldMap.get("content"));
					NewMap.put("VTeam", OldMap.get("vteam"));
					if (OldMap.containsKey("rf") && !"-".equals(OldMap.get("rf").toString()) && !"0".equals(OldMap.get("rf").toString())) {
						NewMap.put("HTeam", OldMap.get("hteam").toString() + "(" + OldMap.get("rf").toString() + ")");
					} else {
						NewMap.put("HTeam", OldMap.get("hteam"));
					}
					NewMap.put("Rf", OldMap.get("rf"));
					NewMap.put("Score", OldMap.get("score"));
				} else {
					NewMap.put("MNo", OldMap.get("no"));
					NewMap.put("Content", OldMap.get("content"));
					NewMap.put("HTeam", OldMap.get("vs")/* OldMap.get("hteam") */);
					NewMap.put("VTeam", OldMap.get("vs")/* OldMap.get("vteam") */);
					NewMap.put("Cg", OldMap.get("cg"));
					// NewMap.put("Rq", OldMap.get("Rq"));
					NewMap.put("Score", OldMap.get("score"));
				}
				NewList.add(NewMap);
			}
			// Log.v("NewList= ", NewList.toString());
			return NewList;
		}
		return null;
	}

	/**
	 * 处理竞彩足球和足球单场(北单)玩法网络数据，按listview字段分别适应加载到SimpleAdapter
	 */
	public List<Map<String, Object>> modifymZQData(List<Map<String, Object>> list) {
		if (list != null && (!"".equals(list)) && list.size() != 0) {
			List<Map<String, Object>> NewList = new ArrayList<Map<String, Object>>();
			for (int i = 0; i < list.size(); i++) {
				if (lottName.indexOf("竞彩", 0) >= 0) {
					Map<String, Object> OldMap = list.get(i);
					Map<String, Object> NewMap = new HashMap<String, Object>();
					if (isJczqHunHe) {
						NewMap.put("MNo", OldMap.get("no"));
						NewMap.put("Content", OldMap.get("content"));
						// 如果是让球胜平负，主队后面加让球
						if (OldMap.get("content").toString().startsWith("让球") && (!"-".equals(OldMap.get("rq").toString()))) {
							NewMap.put("HTeam", OldMap.get("hteam").toString() + "\n" + "(" + OldMap.get("rq").toString() + ")");
						} else {
							NewMap.put("HTeam", OldMap.get("hteam") + "\n");
						}
						NewMap.put("VTeam", OldMap.get("vteam"));
						NewMap.put("hScore", OldMap.get("hscore"));
						NewMap.put("Score", OldMap.get("score"));
						NewList.add(NewMap);
					} else if (isJczqRQSPF) {
						NewMap.put("MNo", OldMap.get("no"));
						NewMap.put("Content", OldMap.get("content"));
						// 如果是让球胜平负，主队后面加让球
						if (!"-".equals(OldMap.get("rq").toString()) && !"0".equals(OldMap.get("rq").toString())) {
							NewMap.put("HTeam", OldMap.get("hteam").toString() + "\n" + "(" + OldMap.get("rq").toString() + ")");
						} else {
							NewMap.put("HTeam", OldMap.get("hteam") + "\n");
						}
						NewMap.put("VTeam", OldMap.get("vteam"));
						// 处理赛果
						String strCG = "";
						strCG = OldMap.get("cg").toString();
						if (!strCG.equals("") && (!strCG.equals("-"))) {
							// 1转平
							strCG = strCG.replaceAll("3", "胜");
							strCG = strCG.replaceAll("1", "平");
							strCG = strCG.replaceAll("0", "负");
						}
						NewMap.put("Cg", strCG);
						NewMap.put("hScore", OldMap.get("hscore"));
						NewMap.put("Score", OldMap.get("score"));
						NewList.add(NewMap);
					} else if (isJczqSPF) {
						NewMap.put("MNo", OldMap.get("no"));
						NewMap.put("Content", OldMap.get("content"));
						NewMap.put("HTeam", OldMap.get("hteam") + "\n");
						NewMap.put("VTeam", OldMap.get("vteam"));
						// 处理赛果
						String strCG = "";
						strCG = OldMap.get("cg").toString();
						if (!strCG.equals("") && (!strCG.equals("-"))) {
							// 1转平
							strCG = strCG.replaceAll("3", "胜");
							strCG = strCG.replaceAll("1", "平");
							strCG = strCG.replaceAll("0", "负");
						}
						NewMap.put("Cg", strCG);
						NewMap.put("hScore", OldMap.get("hscore"));
						NewMap.put("Score", OldMap.get("score"));
						NewList.add(NewMap);
					} else if (isJczqBF) {
						NewMap.put("MNo", OldMap.get("no"));
						NewMap.put("Content", OldMap.get("content"));
						NewMap.put("HTeam", OldMap.get("hteam") + "\n");
						NewMap.put("VTeam", OldMap.get("vteam"));
						// 处理比分赛果
						String strCG = "";
						strCG = OldMap.get("cg").toString();
//						if (!strCG.equals("") && (!strCG.equals("-"))) {
//							// 13转平胜
//							strCG = strCG.replaceAll("3", "胜");
//							strCG = strCG.replaceAll("1", "平");
//							strCG = strCG.replaceAll("0", "负");
//						}
						NewMap.put("Cg", strCG);
						NewMap.put("hScore", OldMap.get("hscore"));
						NewMap.put("Score", OldMap.get("score"));
						NewList.add(NewMap);
					} else if (isJczqBQC) {
						NewMap.put("MNo", OldMap.get("no"));
						NewMap.put("Content", OldMap.get("content"));
						NewMap.put("HTeam", OldMap.get("hteam") + "\n");
						NewMap.put("VTeam", OldMap.get("vteam"));
						// 处理赛果
						String strCG = "";
						strCG = OldMap.get("cg").toString();
						if (!strCG.equals("") && (!strCG.equals("-"))) {
							// 13转平胜
							strCG = strCG.replaceAll("3", "胜");
							strCG = strCG.replaceAll("1", "平");
							strCG = strCG.replaceAll("0", "负");
						}
						NewMap.put("Cg", strCG);
						NewMap.put("hScore", OldMap.get("hscore"));
						NewMap.put("Score", OldMap.get("score"));
						NewList.add(NewMap);
					} else {
						NewMap.put("MNo", OldMap.get("no"));
						NewMap.put("Content", OldMap.get("content"));
						NewMap.put("HTeam", OldMap.get("hteam") + "\n");
						NewMap.put("VTeam", OldMap.get("vteam"));
						NewMap.put("Cg", OldMap.get("cg"));
						NewMap.put("hScore", OldMap.get("hscore"));
						NewMap.put("Score", OldMap.get("score"));
						NewList.add(NewMap);
					}
				} else if (lottName.indexOf("足彩北京单场", 0) >= 0) {// 北京单场
					Map<String, Object> OldMap = list.get(i);
					Map<String, Object> NewMap = new HashMap<String, Object>();
					NewMap.put("MNo", OldMap.get("no"));
					NewMap.put("Content", OldMap.get("content"));
					if (OldMap.get("vs").toString().contains("VS")) {
						NewMap.put("HTeam", OldMap.get("vs").toString().split("VS")[0] + "\n");// "vs":
						// "澳大利亚 VS 中　国"
						NewMap.put("VTeam", OldMap.get("vs").toString().split("VS")[1]);
						// NewMap.put("Rq", 0);
					} else {
						String rq = "";
						if (OldMap.get("vs").toString().split("\\(").length > 1) {
							rq = OldMap.get("vs").toString().split("\\(")[1].split("\\)")[0];
						}
						if ((!"".equals(rq)) && (!"-".equals(rq)) && (!"0".equals(rq))) {
							NewMap.put("HTeam", OldMap.get("vs").toString().split("\\(")[0] + "\n" + "(" + rq + ")");
						} else {
							NewMap.put("HTeam", OldMap.get("vs").toString().split("\\(")[0] + "\n");
						}
						// "vs":// "卢恩吉亚(-1)下卡姆斯"
						String VTeam = OldMap.get("vs").toString().split("\\)")[1];
						if (VTeam.endsWith("胆")) {
							VTeam = VTeam + ")";
						}
						NewMap.put("VTeam", VTeam);
						// NewMap.put("Rq",
						// OldMap.get("vs").toString().split("\\(")[1].split("\\)")[0]);
					}
					// 处理赛果
					String strCG = "";
					strCG = OldMap.get("cg").toString();
					if (isBdBQC || isBdSPF) {
						if (!strCG.equals("") && (!strCG.equals("-"))) {
							// 3转胜
							strCG = strCG.replaceAll("3", "胜");
							strCG = strCG.replaceAll("1", "平");
							strCG = strCG.replaceAll("0", "负");
						}
					}
					if (isBdSXDS) {
						if (!strCG.equals("") && (!strCG.equals("-"))) {
							// 3上单，2上双，1下单，0下双
							strCG = strCG.replaceAll("3", "上单");
							strCG = strCG.replaceAll("2", "上双");
							strCG = strCG.replaceAll("1", "下单");
							strCG = strCG.replaceAll("0", "下双");
						}
					}
					if (isBdBF) {
						if (!strCG.equals("") && (!strCG.equals("-"))) {
							// 90胜其他，99平其他，09负其他
							strCG = strCG.replaceAll("90", "胜其他");
							strCG = strCG.replaceAll("99", "平其他");
							strCG = strCG.replaceAll("09", "负其他");
							if (strCG.length() == 2) {
								strCG = strCG.substring(0, 1) + ":" + strCG.substring(1, 2);
							}
						}
					}
					NewMap.put("Cg", strCG);
					NewMap.put("Score", OldMap.get("score"));
					NewList.add(NewMap);
				}
			}
			// Log.d("modifymJCZQData= ", "NewList= "+NewList.toString());
			return NewList;
		}
		return null;
	}

	// TitleBar标题栏
	public void titleBar() {
		// Title信息(返回+Title)
		Button back = (Button) findViewById(R.id.top_title_back);
		// back.getBackground().setAlpha(255);// 透明度0~255透明度值 ，值越小越透明
		// back.setVisibility(View.INVISIBLE);
		back.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		// TextView back = (TextView) findViewById(R.id.bottom_left_btn);
		// back.setText("<<<<<");
		// back.setOnClickListener(new View.OnClickListener() {
		// @Override
		// public void onClick(View v) {
		// // TODO Auto-generated method stub
		// onKeyDown(KeyEvent.KEYCODE_BACK, null);
		// }
		// });
		TextView info = (TextView) findViewById(R.id.top_title_info);
		info.setText(R.string.betrecord_plandetail);

		Button refres = (Button) findViewById(R.id.top_title_refres);
		// refres.getBackground().setAlpha(155);// 透明度0~255透明度值 ，值越小越透明
		// refres.setVisibility(View.INVISIBLE);
		refres.setVisibility(View.VISIBLE);
		// refres.setBackgroundResource(R.drawable.top_title_share);
		refres.setText("分享");
		refres.setBackgroundColor(0x00000000);

		refres.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stu
				String shareUrl = Constants.SHARE_URL_TEST + schemeID;
				String shareTitle = "";
				String share = mData.get("State").toString();
				// 中奖
				if (share.contains("已中奖")) {
					shareTitle = Constants.PLANDET_SHARE_WIN;
				} else {
					shareTitle = Constants.PLANDET_SHARE_NOT_WIN;
				}
				startActivity(Intent.createChooser(new Intent(Intent.ACTION_SEND).setType("text/plain").putExtra(Intent.EXTRA_TEXT, shareTitle + shareUrl)
						.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), ""));

			}
		});
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			PlanDetailsActivity.this.finish();
			return true;
		} else {
			return super.onKeyDown(keyCode, event);
		}

	};

	@Override
	public void finish() {
		// TODO Auto-generated method stub
		super.finish();
		SysApplication.getInstance().removeActivity(this);
	};

	/**
	 * 数字彩
	 * 
	 * @author Administrator
	 * 
	 */
	public class NumberPlanDetailAdapter extends SimpleAdapter {

		class ViewHolder {
			TextView tv_PlayTypeName;
			TextView tv_LotNum;
		}

		private LayoutInflater inflater = null;
		private int layoutId;
		private List<Map<String, Object>> data;
		private String winNum = null;
		private String lotId;

		public NumberPlanDetailAdapter(PlanDetailsActivity context, List<Map<String, Object>> rData, int resource, String[] from, int[] to, String winNumber,
				String lotid) {
			super(context, rData, resource, from, to);
			data = rData;
			inflater = LayoutInflater.from(PlanDetailsActivity.this);
			layoutId = resource;
			winNum = winNumber;
			lotId = lotid;
		}
		String[] ball_tm_t1_t17_na = {"特单","特双","特大","特小","合单","合双","红波","绿波","蓝波","尾大","尾小","大单","小单","大双","小双","家禽","野兽"};
		String[] ball_zm_t1_t4_na = {"和大","和小","和单","合双"};
		String[] ball_zmt_zmt1_zmt17_na = {"单","双","大","小","红波","蓝波","绿波","合大","合小","合单","合双","尾大","尾小"};
		String[] ball_tmsx_tmsx1_12_na = {"鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"};
		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ViewHolder holder = null;
			holder = new ViewHolder();
			if (convertView == null) {
				convertView = inflater.inflate(layoutId, null);
				holder.tv_PlayTypeName = (TextView) convertView.findViewById(R.id.yhzx_plan_detail_PlayTypeName);
				holder.tv_LotNum = (TextView) convertView.findViewById(R.id.yhzx_plan_detail_winnum);
			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			if(Integer.parseInt(lotId) == 96){
				yhzx_detail_multiple_ll.setVisibility(View.GONE);
				layout_zhushu.setVisibility(View.GONE);
				String playTypeName = data.get(position).get("PlayTypeName").toString();
				if(playTypeName.equals("特码")){//特码
					holder.tv_PlayTypeName.setText(Html.fromHtml(playTypeName));
					String ColorNumber = data.get(position).get("LotNum").toString().replaceAll("class", "color");
					String[] betNum = ColorNumber.split(",");
					String betStr = "";
					for(int i=0;i<betNum.length;i++){
						String num = betNum[i];
						if(i != 0){
							betStr = betStr+",";
						}
						if(i!=0 && i%3==0){
							betStr = betStr+"\n";
						}
						
						String[] numItem = num.split("=");
						if(numItem[0].contains("t")){
							betStr = betStr + ball_tm_t1_t17_na[Integer.parseInt(numItem[0].replace("t", "")) - 1]+":投"+numItem[1]+"元";
						}else{
							betStr = betStr + numItem[0]+":投"+numItem[1]+"元";
						}
					}
					betStr = betStr.replaceAll("\n", "<br>");
					holder.tv_LotNum.setText(Html.fromHtml(betStr));
				}else if(playTypeName.equals("正码特")){//正码特
					String ColorNumber = data.get(position).get("LotNum").toString().replaceAll("class", "color");
					String[] betNum = ColorNumber.split("\\|")[0].split(",");
					holder.tv_PlayTypeName.setText(Html.fromHtml(playTypeName+"-正"+ColorNumber.split("\\|")[1].split("=")[1]+"特"));
					String betStr = "";
					for(int i=0;i<betNum.length;i++){
						String[] numItem = betNum[i].split("=");
						if(i != 0){
							betStr = betStr+",";
						}
						if(i!=0 && i%3==0){
							betStr = betStr+"\n";
						}
						
						if(numItem[0].contains("zmt")){
							betStr = betStr + ball_zmt_zmt1_zmt17_na[Integer.parseInt(numItem[0].replace("zmt", "")) - 1]+":投"+numItem[1]+"元";
						}else{
							betStr = betStr + numItem[0]+":投"+numItem[1]+"元";
						}
					}
					betStr = betStr.replaceAll("\n", "<br>");
					holder.tv_LotNum.setText(Html.fromHtml(betStr));
				}else if(playTypeName.equals("特码生肖")){//特码生肖
					holder.tv_PlayTypeName.setText(Html.fromHtml(playTypeName));
					String ColorNumber = data.get(position).get("LotNum").toString().replaceAll("class", "color");
					String[] betNum = ColorNumber.split(",");
					String betStr = "";
					for(int i=0;i<betNum.length;i++){
						String num = betNum[i];
						if(i != 0){
							betStr = betStr+",";
						}
						if(i!=0 && i%3==0){
							betStr = betStr+"\n";
						}
						
						String[] numItem = num.split("=");
						if(numItem[0].contains("tmsx")){
							betStr = betStr + ball_tmsx_tmsx1_12_na[Integer.parseInt(numItem[0].replace("tmsx", "")) - 1]+":投"+numItem[1]+"元";
						}else{
							betStr = betStr + numItem[0]+":投"+numItem[1]+"元";
						}
					}
					betStr = betStr.replaceAll("\n", "<br>");
					holder.tv_LotNum.setText(Html.fromHtml(betStr));
				}else if(playTypeName.equals("正码")){//正码
					holder.tv_PlayTypeName.setText(Html.fromHtml(playTypeName));
					String ColorNumber = data.get(position).get("LotNum").toString().replaceAll("class", "color");
					String[] betNum = ColorNumber.split(",");
					String betStr = "";
					for(int i=0;i<betNum.length;i++){
						String num = betNum[i];
						if(i != 0){
							betStr = betStr+",";
						}
						if(i!=0 && i%3==0){
							betStr = betStr+"\n";
						}
						String[] numItem = num.split("=");
						if(numItem[0].contains("h")){
							betStr = betStr + ball_zm_t1_t4_na[Integer.parseInt(numItem[0].replace("h", "")) - 1]+":投"+numItem[1]+"元";
						}else{
							betStr = betStr + numItem[0]+":投"+numItem[1]+"元";
						}
					}
					betStr = betStr.replaceAll("\n", "<br>");
					holder.tv_LotNum.setText(Html.fromHtml(betStr));
				}else if(playTypeName.equals("连码")){//连码
					String ColorNumber = data.get(position).get("LotNum").toString().replaceAll("class", "color");
					String betNum = ColorNumber.split("\\|")[0];
					String ppname = "";
					if(ColorNumber.split("\\|")[1].equals("lm3qz")){
						ppname = "三全中";
					}else if(ColorNumber.split("\\|")[1].equals("lm3z2")){
						ppname = "三中二";
					}else if(ColorNumber.split("\\|")[1].equals("lm2qz")){
						ppname = "二全中";
					}else if(ColorNumber.split("\\|")[1].equals("lm2zt")){
						ppname = "二中特";
					}else if(ColorNumber.split("\\|")[1].equals("lmtc")){
						ppname = "特串";
					}else if(ColorNumber.split("\\|")[1].equals("lm4z1")){
						ppname = "四中一";
					}
					holder.tv_PlayTypeName.setText(Html.fromHtml(playTypeName+"-"+ppname));
					String betStr = "";
					String[] numItem = betNum.split("=");
					betStr = betStr + numItem[0]+":投"+numItem[1]+"元";
					betStr = betStr.replaceAll("\n", "<br>");
					holder.tv_LotNum.setText(Html.fromHtml(betStr));
				}else if(playTypeName.equals("生肖连")){//生肖连
					String ColorNumber = data.get(position).get("LotNum").toString().replaceAll("class", "color");
					String betNum = ColorNumber.split("\\|")[0];
					String ppname = "";
					if(ColorNumber.split("\\|")[1].equals("sxl2xlz")){
						ppname = "二肖连中";
					}else if(ColorNumber.split("\\|")[1].equals("sxl3xlz")){
						ppname = "三肖连中";
					}else if(ColorNumber.split("\\|")[1].equals("sxl4xlz")){
						ppname = "四肖连中";
					}else if(ColorNumber.split("\\|")[1].equals("sxl5xlz")){
						ppname = "五肖连中";
					}else if(ColorNumber.split("\\|")[1].equals("sxl2xlbz")){
						ppname = "二肖连不中";
					}else if(ColorNumber.split("\\|")[1].equals("sxl3xlbz")){
						ppname = "三肖连不中";
					}else if(ColorNumber.split("\\|")[1].equals("sxl4xlbz")){
						ppname = "四肖连不中";
					}else if(ColorNumber.split("\\|")[1].equals("sxl1xlz")){
						ppname = "一肖";
					}
					holder.tv_PlayTypeName.setText(Html.fromHtml(playTypeName+"-"+ppname));
					String betStr = "";
					String[] numItem = betNum.split("=");
					
//					if(numItem[0].contains("tmsx")){
					String[] betNum2 = numItem[0].split(",");
					for(int i=0;i<betNum2.length;i++){
						if(i != 0){
							betStr = betStr +",";
						}
						betStr = betStr + ball_tmsx_tmsx1_12_na[Integer.parseInt(betNum2[i]) - 1];
					}
						betStr = betStr +":投"+numItem[1]+"元";
//					}else{
////						betStr = betStr + numItem[0]+":投"+numItem[1]+"元";
//						betStr = betStr + numItem[0]+":投"+numItem[1]+"元";
//					}
					betStr = betStr.replaceAll("\n", "<br>");
					holder.tv_LotNum.setText(Html.fromHtml(betStr));
				}
			}else{
				String playTypeName = data.get(position).get("PlayTypeName").toString();
				holder.tv_PlayTypeName.setText(Html.fromHtml(playTypeName));
				String ColorNumber = data.get(position).get("LotNum").toString().replaceAll("class", "color");
				ColorNumber = ColorNumber.replaceAll("\n", "<br>");
				holder.tv_LotNum.setText(Html.fromHtml(ColorNumber));
			}
			convertView.setTag(holder);
			return convertView;
		}

	}

	/**
	 * 胜负彩
	 * 
	 * @author Administrator
	 * 
	 */
	public class SFCPlanDetailAdapter extends SimpleAdapter {

		class ViewHolder {
			TextView tv_no;
			TextView tv_hteam;
			TextView tv_vteam;
			TextView tv_tz;
			TextView tv_score;
			TextView tv_cg;
		}

		private LayoutInflater inflater = null;
		private int layoutId;
		private List<Map<String, Object>> data;

		public SFCPlanDetailAdapter(PlanDetailsActivity context, List<Map<String, Object>> rData, int resource, String[] from, int[] to) {
			super(context, rData, resource, from, to);
			data = rData;
			inflater = LayoutInflater.from(PlanDetailsActivity.this);
			layoutId = resource;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ViewHolder holder = null;
			holder = new ViewHolder();
			if (convertView == null) {
				convertView = inflater.inflate(layoutId, null);
				holder.tv_no = (TextView) convertView.findViewById(R.id.yhzx_detail_list_mno);
				holder.tv_tz = (TextView) convertView.findViewById(R.id.yhzx_detail_list_tzh);
				holder.tv_hteam = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hteam);
				holder.tv_vteam = (TextView) convertView.findViewById(R.id.yhzx_detail_list_vteam);
				holder.tv_cg = (TextView) convertView.findViewById(R.id.yhzx_detail_list_cg);
				holder.tv_score = (TextView) convertView.findViewById(R.id.yhzx_detail_list_score);

			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.tv_no.setText(data.get(position).get("NO").toString());
			holder.tv_tz.setText(Html.fromHtml(data.get(position).get("Content").toString()));
			holder.tv_hteam.setText(data.get(position).get("HTeam").toString());
			// holder.tv_vteam.setText(data.get(position).get("VTeam").toString());
			holder.tv_cg.setText(data.get(position).get("Result").toString());
			holder.tv_score.setText(Html.fromHtml(data.get(position).get("Score").toString()));
			// if(!data.get(position).get("Score").toString().equals("-")){
			// holder.tv_score.setTextColor(getResources().getColor(R.color.red_ssqfont));//c_plandetails_sfc_red
			// }
			convertView.setTag(holder);
			return convertView;
		}

	}

	/**
	 * 竞彩足球混合过关
	 * 
	 * @author Administrator
	 * 
	 */
	public class jczqhhPlanDetailAdapter extends SimpleAdapter {

		class ViewHolder {
			TextView tv_no;
			TextView tv_hteam;
			// TextView tv_vteam;
			TextView tv_tz;
			TextView tv_hscore;
			TextView tv_score;
		}

		private LayoutInflater inflater = null;
		private int layoutId;
		private List<Map<String, Object>> data;

		public jczqhhPlanDetailAdapter(PlanDetailsActivity context, List<Map<String, Object>> rData, int resource, String[] from, int[] to) {
			super(context, rData, resource, from, to);
			data = rData;
			inflater = LayoutInflater.from(PlanDetailsActivity.this);
			layoutId = resource;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ViewHolder holder = null;
			holder = new ViewHolder();
			if (convertView == null) {
				convertView = inflater.inflate(layoutId, null);
				holder.tv_no = (TextView) convertView.findViewById(R.id.yhzx_detail_list_mno);
				holder.tv_tz = (TextView) convertView.findViewById(R.id.yhzx_detail_list_tzh);
				holder.tv_hteam = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hteam_and_vteam);
				// holder.tv_vteam = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_vteam);
				holder.tv_hscore = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hscore);
				holder.tv_score = (TextView) convertView.findViewById(R.id.yhzx_detail_list_score);

			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.tv_no.setText(data.get(position).get("MNo").toString());
			holder.tv_tz.setText(Html.fromHtml(data.get(position).get("Content").toString()));
			String string = data.get(position).get("HTeam").toString();
			String newString = string.replace("()", "");
			holder.tv_hteam.setText(newString + "VS\n" + data.get(position).get("VTeam").toString());
			// holder.tv_vteam.setText(data.get(position).get("VTeam").toString());
			// holder.tv_hscore.setText(Html.fromHtml(data.get(position).get("hScore").toString()));
			if (isMyWinMoney) {
				holder.tv_hscore.setTextColor(getResources().getColor(R.color.red_ssqfont));// c_plandetails_sfc_red
				holder.tv_score.setTextColor(getResources().getColor(R.color.red_ssqfont));
			}
			holder.tv_score.setText(Html.fromHtml(data.get(position).get("Score").toString()));

			convertView.setTag(holder);
			return convertView;
		}

	}

	/**
	 * 竞彩足球(混合过关除外),北京单场
	 * 
	 * @author Administrator
	 * 
	 */
	public class jczqPlanDetailAdapter extends SimpleAdapter {

		class ViewHolder {
			TextView tv_no;
			TextView tv_hteam;
			// TextView tv_vteam;
			TextView tv_tz;
			TextView tv_cg;
			TextView tv_score;
		}

		private LayoutInflater inflater = null;
		private int layoutId;
		private List<Map<String, Object>> data;

		public jczqPlanDetailAdapter(PlanDetailsActivity context, List<Map<String, Object>> rData, int resource, String[] from, int[] to) {
			super(context, rData, resource, from, to);
			data = rData;
			inflater = LayoutInflater.from(PlanDetailsActivity.this);
			layoutId = resource;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ViewHolder holder = null;
			holder = new ViewHolder();
			if (convertView == null) {
				convertView = inflater.inflate(layoutId, null);
				holder.tv_no = (TextView) convertView.findViewById(R.id.yhzx_detail_list_mno);
				holder.tv_tz = (TextView) convertView.findViewById(R.id.yhzx_detail_list_tzh);
				holder.tv_hteam = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hteam_and_vteam);
				// holder.tv_vteam = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_vteam);
				holder.tv_cg = (TextView) convertView.findViewById(R.id.yhzx_detail_list_cg);
				holder.tv_score = (TextView) convertView.findViewById(R.id.yhzx_detail_list_score);

			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.tv_no.setText(data.get(position).get("MNo").toString());
			holder.tv_tz.setText(Html.fromHtml(data.get(position).get("Content").toString()));
			holder.tv_hteam.setText(data.get(position).get("HTeam").toString() + "VS\n" + data.get(position).get("VTeam").toString());
			// holder.tv_vteam.setText(data.get(position).get("VTeam").toString());
			// if (data.get(position).get("Cg")!=null) {
			holder.tv_cg.setText(data.get(position).get("Cg").toString());
			// }else {
			// holder.tv_cg.setText("-");
			// }

			holder.tv_score.setText(Html.fromHtml(data.get(position).get("Score").toString()));

			convertView.setTag(holder);
			return convertView;
		}

	}

	/**
	 * 竞彩蓝球大小分
	 * 
	 * @author Administrator
	 * 
	 */
	public class jclqDXFPlanDetailAdapter extends SimpleAdapter {

		class ViewHolder {
			TextView tv_no;
			TextView tv_hteam;
			// TextView tv_vteam;
			TextView tv_tz;
			TextView tv_cg;
			// TextView tv_rq;
			TextView tv_score;
			// TextView tv_ysf;
		}

		private LayoutInflater inflater = null;
		private int layoutId;
		private List<Map<String, Object>> data;

		public jclqDXFPlanDetailAdapter(PlanDetailsActivity context, List<Map<String, Object>> rData, int resource, String[] from, int[] to) {
			super(context, rData, resource, from, to);
			data = rData;
			inflater = LayoutInflater.from(PlanDetailsActivity.this);
			layoutId = resource;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ViewHolder holder = null;
			holder = new ViewHolder();
			if (convertView == null) {
				convertView = inflater.inflate(layoutId, null);
				holder.tv_no = (TextView) convertView.findViewById(R.id.yhzx_detail_list_mno);
				holder.tv_tz = (TextView) convertView.findViewById(R.id.yhzx_detail_list_tzh);
				holder.tv_hteam = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hteam_and_vteam);
				// holder.tv_vteam = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_vteam);
				holder.tv_cg = (TextView) convertView.findViewById(R.id.yhzx_detail_list_cg);
				// holder.tv_rq = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_rq);
				holder.tv_score = (TextView) convertView.findViewById(R.id.yhzx_detail_list_score);
				// holder.tv_ysf = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_tvysf);

			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.tv_no.setText(data.get(position).get("MNo").toString());
			holder.tv_tz.setText(Html.fromHtml(data.get(position).get("Content").toString()));
			holder.tv_hteam.setText(data.get(position).get("HTeam").toString());
			// holder.tv_hteam.setText(data.get(position).get("VTeam").toString()
			// + "\n("
			// + Html.fromHtml(data.get(position).get("ysf").toString()) +
			// ")VS\n"
			// + data.get(position).get("HTeam").toString());
			// holder.tv_vteam.setText(data.get(position).get("VTeam").toString());
			holder.tv_cg.setText(data.get(position).get("Cg").toString());
			// holder.tv_rq.setText(Html.fromHtml(data.get(position).get("ysf").toString()));
			holder.tv_score.setText(Html.fromHtml(data.get(position).get("Score").toString()));
			// holder.tv_ysf.setText(Html.fromHtml(data.get(position).get("ysftv").toString()));

			convertView.setTag(holder);
			return convertView;
		}

	}

	/**
	 * 竞彩蓝球让分胜负
	 * 
	 * @author Administrator
	 * 
	 */
	public class jclqRFSFPlanDetailAdapter extends SimpleAdapter {

		class ViewHolder {
			TextView tv_no;
			TextView tv_hteam;
			// TextView tv_vteam;
			TextView tv_tz;
			TextView tv_cg;
			// TextView tv_rq;
			TextView tv_score;
		}

		private LayoutInflater inflater = null;
		private int layoutId;
		private List<Map<String, Object>> data;

		public jclqRFSFPlanDetailAdapter(PlanDetailsActivity context, List<Map<String, Object>> rData, int resource, String[] from, int[] to) {
			super(context, rData, resource, from, to);
			data = rData;
			inflater = LayoutInflater.from(PlanDetailsActivity.this);
			layoutId = resource;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ViewHolder holder = null;
			holder = new ViewHolder();
			if (convertView == null) {
				convertView = inflater.inflate(layoutId, null);
				holder.tv_no = (TextView) convertView.findViewById(R.id.yhzx_detail_list_mno);
				holder.tv_tz = (TextView) convertView.findViewById(R.id.yhzx_detail_list_tzh);
				holder.tv_hteam = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hteam_and_vteam);
				// holder.tv_vteam = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_vteam);
				holder.tv_cg = (TextView) convertView.findViewById(R.id.yhzx_detail_list_cg);
				// holder.tv_rq = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_rq);
				holder.tv_score = (TextView) convertView.findViewById(R.id.yhzx_detail_list_score);

			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.tv_no.setText(data.get(position).get("MNo").toString());
			holder.tv_tz.setText(Html.fromHtml(data.get(position).get("Content").toString()));
			// holder.tv_hteam.setText(data.get(position).get("VTeam").toString()
			// + "\n("
			// + Html.fromHtml(data.get(position).get("Rq").toString()) +
			// ")VS\n"
			// + data.get(position).get("HTeam").toString());
			holder.tv_hteam.setText(data.get(position).get("HTeam").toString());
			// holder.tv_vteam.setText(data.get(position).get("VTeam").toString());
			holder.tv_cg.setText(data.get(position).get("Cg").toString());
			// holder.tv_rq.setText(Html.fromHtml(data.get(position).get("Rq").toString()));
			holder.tv_score.setText(Html.fromHtml(data.get(position).get("Score").toString()));

			convertView.setTag(holder);
			return convertView;
		}

	}

	/**
	 * 竞彩蓝球(除大小分，让分胜负,混合投注)
	 * 
	 * @author Administrator
	 * 
	 */
	public class jclqPlanDetailAdapter extends SimpleAdapter {

		class ViewHolder {
			TextView tv_no;
			TextView tv_hteam;
			// TextView tv_vteam;
			TextView tv_tz;
			TextView tv_cg;
			TextView tv_score;
		}

		private LayoutInflater inflater = null;
		private int layoutId;
		private List<Map<String, Object>> data;

		public jclqPlanDetailAdapter(PlanDetailsActivity context, List<Map<String, Object>> rData, int resource, String[] from, int[] to) {
			super(context, rData, resource, from, to);
			data = rData;
			inflater = LayoutInflater.from(PlanDetailsActivity.this);
			layoutId = resource;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ViewHolder holder = null;
			holder = new ViewHolder();
			if (convertView == null) {
				convertView = inflater.inflate(layoutId, null);
				holder.tv_no = (TextView) convertView.findViewById(R.id.yhzx_detail_list_mno);
				holder.tv_tz = (TextView) convertView.findViewById(R.id.yhzx_detail_list_tzh);
				holder.tv_hteam = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hteam_and_vteam);
				// holder.tv_vteam = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_vteam);
				holder.tv_cg = (TextView) convertView.findViewById(R.id.yhzx_detail_list_cg);
				holder.tv_score = (TextView) convertView.findViewById(R.id.yhzx_detail_list_score);

			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.tv_no.setText(data.get(position).get("MNo").toString());
			holder.tv_tz.setText(Html.fromHtml(data.get(position).get("Content").toString()));
			// holder.tv_hteam.setText(data.get(position).get("VTeam").toString()
			// + "\nVS\n"
			// + data.get(position).get("HTeam").toString());
			holder.tv_hteam.setText(data.get(position).get("HTeam").toString());
			// holder.tv_vteam.setText(data.get(position).get("VTeam").toString());
			holder.tv_cg.setText(data.get(position).get("Cg").toString());
			holder.tv_score.setText(Html.fromHtml(data.get(position).get("Score").toString()));

			convertView.setTag(holder);
			return convertView;
		}

	}

	/**
	 * 竞彩蓝球混合投注
	 * 
	 * @author Administrator
	 * 
	 */
	public class jclqHunHePlanDetailAdapter extends SimpleAdapter {

		class ViewHolder {
			TextView tv_no;
			TextView tv_hteam;
			// TextView tv_vteam;
			TextView tv_tz;
			TextView tv_rf;
			TextView tv_score;
			View view_line;
		}

		private LayoutInflater inflater = null;
		private int layoutId;
		private List<Map<String, Object>> data;

		public jclqHunHePlanDetailAdapter(PlanDetailsActivity context, List<Map<String, Object>> rData, int resource, String[] from, int[] to) {
			super(context, rData, resource, from, to);
			data = rData;
			inflater = LayoutInflater.from(PlanDetailsActivity.this);
			layoutId = resource;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			ViewHolder holder = null;
			holder = new ViewHolder();
			if (convertView == null) {
				convertView = inflater.inflate(layoutId, null);
				holder.tv_no = (TextView) convertView.findViewById(R.id.yhzx_detail_list_mno);
				holder.tv_tz = (TextView) convertView.findViewById(R.id.yhzx_detail_list_tzh);
				holder.tv_hteam = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hteam_and_vteam);
				// holder.tv_vteam = (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_vteam);
				// holder.tv_rf= (TextView)
				// convertView.findViewById(R.id.yhzx_detail_list_rf);
				holder.tv_rf = (TextView) convertView.findViewById(R.id.yhzx_detail_list_hscore);
				holder.tv_score = (TextView) convertView.findViewById(R.id.yhzx_detail_list_score);
				holder.tv_rf.setVisibility(View.GONE);
				holder.view_line = convertView.findViewById(R.id.yhzx_detail_list_hscore_line);// yhzx_detail_list_hscore_line
				holder.view_line.setVisibility(View.GONE);
			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.tv_no.setText(data.get(position).get("MNo").toString());
			holder.tv_tz.setText(Html.fromHtml(data.get(position).get("Content").toString()));
			// holder.tv_hteam.setText(data.get(position).get("VTeam").toString()
			// + "\nVS\n"
			// + data.get(position).get("HTeam").toString());
			holder.tv_hteam.setText(data.get(position).get("HTeam").toString());
			// holder.tv_vteam.setText(data.get(position).get("VTeam").toString());
			// if(data.get(position).containsKey("Rf")){
			// holder.tv_rf.setText(Html.fromHtml(data.get(position).get("Rf").toString()));
			// }else{
			// holder.tv_rf.setText("");
			// }

			holder.tv_score.setText(Html.fromHtml(data.get(position).get("Score").toString()));

			convertView.setTag(holder);
			return convertView;
		}

	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);

		Logger.e("PlanDetailsActivity", "requestCode = " + requestCode + ", resultCode = " + resultCode);

		if (requestCode == 911 && resultCode == Activity.RESULT_OK) {
			setResult(Activity.RESULT_OK);
			this.finish();
		}

	}

}